import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { LogsService } from './app-logs.service';
import { CreateLogDto } from './dto/create-log.dto';
import { UpdateLogDto } from './dto/update-log.dto';
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@Controller('logs')
@ApiTags('日志管理')
export class LogsController {
  constructor(private readonly logsService: LogsService) {}

  @Get('page')
  @ApiOperation({ summary: '日志分页列表' })
  findByPage(@Body() createLogDto: CreateLogDto) {
    return this.logsService.findByPage(createLogDto);
  }

  @Get('visit-stats')
  @ApiOperation({ summary: '获取访问统计' })
  visitStats() {
    return this.logsService.visitStats();
  }

  @Get('visit-trend')
  @ApiOperation({ summary: '获取访问趋势' })
  visitTrend() {
    return this.logsService.visitTrend();
  }
}
